<template>
	<view class="combody">
		<view class="head flex-row">
			<view class="headtetx ischoose" style="">
				{{head==1?'相关文章':head==2?'推荐文章':''}}
				<view class="linebox">
				</view>
			</view>
		</view>
		<view class="listbox" v-for="(item,index) in newsList" :key="index">
			<view class="newscard">
				<view class="title lineclamp2" @click="toNews(item.id)">
					{{item.name}}
				</view>
				<view class="content lineclamp2">
					{{item.nostyletext?item.nostyletext.slice(0,40)+"...":''}} <span @click="toNews(item.id)"
						style="font-weight:400;font-size:32rpx;color:#00977C;line-height:35rpx;">[ 详情 ]</span>
				</view>
				<view class="flex-row justify-between align-center " style="margin: 32rpx 0;">
					<view class="" style="color: #7E8987; font-size: 24rpx;">
						推荐指数：{{item.hits}}
					</view>
					<view class="" style="color: #7E8987; font-size: 24rpx;">
						{{item.createTime}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: ['head', 'newsList'],
		data() {
			return {
				choosetype: 1,

			}
		},
		methods: {

			toNews(id) {
				uni.navigateTo({
					url: '/pages/knowledge/drugnews?id=' + id,
				});
			}
		}

	}
</script>

<style lang="scss" scoped>
	.combody {
		background: #fff;
		border-radius: 32rpx;
		margin-top: 16rpx;

		.head {
			height: 110rpx;
			padding: 10rpx 32rpx 0;
			border-bottom: 1px solid #D7DDDC;

			.headtetx {
				font-size: 40rpx;
				display: flex;
				align-items: center;
				height: 100rpx;
				margin-right: 40rpx;
				position: relative;

				.linebox {
					position: absolute;
					bottom: 0;
					width: 160rpx;
					height: 10rpx;
					background: #00D9B2;
					border-radius: 50rpx;
				}
			}

			.ischoose {
				color: #303B39;
				font-weight: 800;
			}

			.nochoose {
				color: #576260;
				font-weight: 400;
			}
		}


		.listbox {
			padding: 0 24rpx 24rpx;

			.newscard:nth-last-child(1) {
				border-bottom: none;
			}

			.newscard {
				border-bottom: 1rpx dashed #D7DDDC;
				margin-top: 24rpx;

				.title {
					font-size: 38rpx;
					color: #303B39;
					line-height: 72rpx;
					text-align: left;
					font-weight: 600;
				}

				.content {
					font-weight: 500;
					font-size: 32rpx;
					color: #576260;
					line-height: 56rpx;
				}
			}

		}
	}
</style>